package com.ebao.util.converter;

import org.apache.commons.beanutils.Converter;

import com.ebao.constants.Gender;

/**
 * @author snow
 * @date 2012-5-24
 */
public class GenderConverter implements Converter {

	@SuppressWarnings("rawtypes")
	public Object convert(Class clazz, Object value) {
		if (value == null || "".equals((String) value))
			return null;
		if (value instanceof Gender)
			return value;
		try {
			return Gender.valueOf((String) value);
		} catch (Exception e) {
		}
		return null;
	}
}
